﻿using FluentNHibernate.Mapping;
using TimeTracker.Core.Domain.Entities;

namespace TimeTracker.Core.Domain.Mappings
{
    public class OrganizacionaSemaMappings : ClassMap<OrganizacionaSema>
    {
        public OrganizacionaSemaMappings()
        {
            Table("OrganizacionaSema");

            Id(x => x.OrganizacionaSemaId).GeneratedBy.Identity();
            Map(x => x.ImeOrganizacioneSeme);
            Map(x => x.ImeOrganizacioneSemeSkraceno);

            HasMany(x => x.Radnici)
                .Inverse()
                .AsBag()
                .Cascade.AllDeleteOrphan()
                .KeyColumn("RadnikId");
        }
    }
}
